package com.salinity.kun.algorithm.harmonic;

import java.util.HashMap;
import java.util.Map;


/**
 * Doodson数
 * 
 * u1,u2,u3,u4,u5,u6,u0 (严格按照此顺序，u0在最后)
 * 
 * @author CK
 *
 */
public class Doodson {
	private Map<TideSymbol, int[]> doodsonMap = null;
	public Doodson() {
	}
	public void init() {
		doodsonMap = new HashMap<>();
		doodsonMap.put(TideSymbol.Sa, new int[] { 0, 0, 1, 0, 0, 0, 0 });
		doodsonMap.put(TideSymbol.Ssa, new int[] { 0, 0, 2, 0, 0, 0, 0 });
		doodsonMap.put(TideSymbol.Mm, new int[] { 0, 1, 0, -1, 0, 0, 0 });
		doodsonMap.put(TideSymbol.MSf, new int[] { 0, 2, -2, 0, 0, 0, 0 });
		doodsonMap.put(TideSymbol.Mf, new int[] { 0, 2, 0, 0, 0, 0, 0 });
		doodsonMap.put(TideSymbol.Q1, new int[] { 1, -2, 0, 1, 0, 0, -1 });
		doodsonMap.put(TideSymbol.O1, new int[] { 1, -1, 0, 0, 0, 0, -1 });
		doodsonMap.put(TideSymbol.M1, new int[] { 1, 0, 0, 0, 0, 0, 1 });
		doodsonMap.put(TideSymbol.P1, new int[] { 1, 1, -2, 0, 0, 0, -1 });
		doodsonMap.put(TideSymbol.S1, new int[] { 1, 1, -1, 0, 0, 0, 2 });
		doodsonMap.put(TideSymbol.K1, new int[] { 1, 1, 0, 0, 0, 0, 1 });
		doodsonMap.put(TideSymbol.J1, new int[] { 1, 2, 0, -1, 0, 0, 1 });
		doodsonMap.put(TideSymbol.OO1, new int[] { 1, 3, 0, 0, 0, 0, 1 });
		doodsonMap.put(TideSymbol.N2, new int[] { 2, -1, 0, 1, 0, 0, 0 });
		doodsonMap.put(TideSymbol.M2, new int[] { 2, 0, 0, 0, 0, 0, 0 });
		doodsonMap.put(TideSymbol.L2, new int[] { 2, 1, 0, -1, 0, 0, 2 });
		doodsonMap.put(TideSymbol.S2, new int[] { 2, 2, -2, 0, 0, 0, 0 });
		doodsonMap.put(TideSymbol.K2, new int[] { 2, 2, 0, 0, 0, 0, 0 });
		doodsonMap.put(TideSymbol.M4, new int[] { 4, 0, 0, 0, 0, 0, 0 });
		doodsonMap.put(TideSymbol.MS4, new int[] { 4, 2, -2, 0, 0, 0, 0 });
		doodsonMap.put(TideSymbol.M6, new int[] { 6, 0, 0, 0, 0, 0, 0 });
	}

	public Map<TideSymbol, int[]> getDoodson() {
		return doodsonMap;
	}

	public int[] get(TideSymbol tideSymbol) {
		return doodsonMap.get(tideSymbol);
	}
}
